import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import Layout from '@/views/layout/index.vue'
import RolePage from '@/views/Role/index.vue'
import LoginPage from '@/views/Login/index.vue'
import UserPage from '@/views/User/index.vue'
import DictPage from '@/views/Dict/index.vue'
import PermissionPage from '@/views/Permission/index.vue'
import MenuPage from '@/views/Menu/index.vue'

export const routerList: RouteRecordRaw[] = [
  {
    path: '/',
    component: Layout,
    redirect: '/role',
    meta: {
      breadcrumb: '系统管理',
    },
    children: [
      {
        path: 'role',
        component: RolePage,
        meta: {
          breadcrumb: '角色管理',
        },
      },
      {
        path: 'user',
        component: UserPage,
        meta: {
          breadcrumb: '用户管理'
        }
      },
      {
        path: 'dict',
        component: DictPage,
        meta: {
          breadcrumb: '字典管理'
        }
      },
      {
        path:'permission',
        component: PermissionPage,
        meta: {
          breadcrumb: '权限资源'
        }
      },
      {
        path:'menu',
        component: MenuPage,
        meta: {
          breadcrumb: '菜单管理'
        }
      }
    ],
  },
  {
    path: '/login',
    component: LoginPage,
    meta: {
      breadcrumb: '登录',
    },
  },
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: routerList,
})

export default router
